//
//  SocketRocketUtility.h
//  SUN
//
//  Created by 曹宗华 on 17/2/16.
//  Copyright © 2017年 SUN. All rights reserved.
//

#import <Foundation/Foundation.h>
//#import <SocketRocket.h>
#import "SocketRocket.h"

@protocol  receiveMessageDelegate <NSObject>

- (void)receiveServerMessage:(NSDictionary*)message;

@end
@interface SocketRocketUtility : NSObject

/** 连接状态 */
@property (nonatomic,assign) SRReadyState socketReadyState;
@property(nonatomic,strong)NSString *token;  //传入token
@property(nonatomic,strong)NSString *serverAddress;
@property(nonatomic,strong)NSString *serverHost;
@property(nonatomic,assign)int wssPort;
@property(nonatomic,assign)int wsPort;

@property(nonatomic,strong)NSString *userId;
@property(nonatomic,assign)id<receiveMessageDelegate> delegate;
+ (SocketRocketUtility *)instance;

-(void)SRWebSocketOpen;//开启连接
-(void)SRWebSocketOpenwithServer:(NSString*)server token:(NSString*)token userId:(NSString*)userid;//开启连接  传入服务器地址和token参数
-(void)SRWebSocketClose;//关闭连接
- (void)sendData:(id)data;//发送数据

@end
